package com.sluggard.ai.config;

import io.milvus.client.MilvusServiceClient;
import io.milvus.param.ConnectParam;
import io.milvus.param.IndexType;
import io.milvus.param.MetricType;
import jakarta.annotation.Resource;
import org.springframework.ai.embedding.EmbeddingModel;
import org.springframework.ai.embedding.TokenCountBatchingStrategy;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.ai.vectorstore.milvus.MilvusVectorStore;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 类描述：
 *
 * @author lizheng
 * @created 2025/4/23 10:07
 */
@Configuration
@EnableConfigurationProperties(MilvusProperties.class)
public class MilvusConfig {

    @Resource
    private MilvusProperties milvusProperties;

    @Bean
    public MilvusServiceClient milvusClient() {
        return new MilvusServiceClient(ConnectParam.newBuilder()
                .withAuthorization(milvusProperties.getUsername(), milvusProperties.getPassword())
                .withHost(milvusProperties.getHost())
                .withPort(milvusProperties.getPort())
                .build());
    }

}
